//
//  ActivityListViewCell.m
//  豆瓣YHY
//
//  Created by dllo on 15/10/27.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "ActivityListViewCell.h"

@implementation ActivityListViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatSubviews];
    }
    
    return self;
    
    
}





- (void)creatSubviews{
    
    UIImageView *imageView =[[UIImageView alloc]initWithFrame:CGRectMake(10, 15, 355, 160)];
    [imageView setImage:[UIImage imageNamed:@"bg_eventlistcell.png"]];
    [self.contentView addSubview:imageView];
    
    self.nameLable = [[UILabel alloc]initWithFrame:CGRectMake(18, 20, 330, 17)];
     //self.nameLable.backgroundColor = [UIColor purpleColor];
    [self.contentView addSubview:self.nameLable];
    
    UIImageView *imageView1 =[[UIImageView alloc]initWithFrame:CGRectMake(25, 40, 330, 130)];
    [imageView1 setImage:[UIImage imageNamed:@"bg_share_large.png"]];
    [self.contentView addSubview:imageView1];
    
    
    
    
    
    UIImageView *imageView2 =[[UIImageView alloc]initWithFrame:CGRectMake(30, 43, 20, 20)];
    [imageView2 setImage:[UIImage imageNamed:@"icon_date.png"]];
    [self.contentView addSubview:imageView2];
    self.timeLable = [[UILabel alloc]initWithFrame:CGRectMake(55, 43, 200, 20)];
    // self.timeLable.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.timeLable];
    
    UIImageView *imageView3 =[[UIImageView alloc]initWithFrame:CGRectMake(30, 65, 20, 20)];
    [imageView3 setImage:[UIImage imageNamed:@"icon_spot.png"]];
    [self.contentView addSubview:imageView3];
    
    self.addLable = [[UILabel alloc]initWithFrame:CGRectMake(55, 65, 200, 20)];
    //self.addLable.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.addLable];
    
    
    
    UIImageView *imageView4 =[[UIImageView alloc]initWithFrame:CGRectMake(30, 87, 20, 20)];
    [imageView4 setImage:[UIImage imageNamed:@"icon_catalog.png"]];
    [self.contentView addSubview:imageView4];
    
    self.styleLable = [[UILabel alloc]initWithFrame:CGRectMake(100, 87, 200, 20)];
    //self.styleLable.backgroundColor = [UIColor redColor];
    self.styleLable.text = @"";
    [self.contentView addSubview:self.styleLable];
    
    UILabel *lable1 =[[UILabel alloc]initWithFrame:CGRectMake(55, 87, 200, 20)];
    lable1.text = @"类型：";
    [self.contentView addSubview:lable1];
    
    
    
    
    self.likeLable = [[UILabel alloc]initWithFrame:CGRectMake(125, 140, 60, 20)];
    
    //self.likeLable.backgroundColor = [UIColor redColor];
    self.likeLable.text = @"";
    [self.contentView addSubview:self.likeLable];
    
    UILabel *lable2 =[[UILabel alloc]initWithFrame:CGRectMake(55, 140, 80, 20)];
    lable2.text = @"感兴趣：";
    [self.contentView addSubview:lable2];
    
    
    
    self.joinLable = [[UILabel alloc]initWithFrame:CGRectMake(230, 140, 97, 20)];
    self.joinLable.text = @"";
    //self.joinLable.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.joinLable];
    
    UILabel *lable3 =[[UILabel alloc]initWithFrame:CGRectMake(175, 140, 80, 20)];
    lable3.text = @"参加：";
    [self.contentView addSubview:lable3];
    
    
    
    
    UIImageView *imageView5 =[[UIImageView alloc]initWithFrame:CGRectMake(270, 43, 75, 110)];
    //[imageView5 setImage:[UIImage imageNamed:@"22.png"]];
    [self.contentView addSubview:imageView5];
    
    
    self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(260, 45, 70, 90)];
    [self.contentView addSubview:self.headImageView];
    
}

-(void)setActivity:(Activitylist *)activity{
    
    if (_activity!=activity) {
        [_activity release];
        _activity = [activity retain];
    }
    self.nameLable.text =_activity.title;
    self.timeLable.text=_activity.begin_time;
    self.addLable.text =_activity.address;
    self.joinLable.text =[NSString stringWithFormat:@"%ld",(long)_activity.participant_count];
    self.likeLable.text=[NSString stringWithFormat:@"%ld",(long)_activity.wisher_count];
    self.styleLable .text =_activity.category_name;
    self.headImageView.image =_activity.image_hlarge;

   self.owner =[activity.owner objectForKey:@"name"];
  //  NSLog(@"%@",self.owner);
}




@end
